package com.iqiyi.pps.epg.core.model.news;

import com.iqiyi.pps.epg.api.model.web.news.TNewsDetailsData;
import com.iqiyi.pps.epg.core.utils.DateTimeUtil;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by zhang on 2016/11/28.
 */
@Entity
@Table(name = "zzd_news")
@Cache(usage = CacheConcurrencyStrategy.NONE)
public class NewsDetails {
    private Long id;
    private String newsName;            //新闻节目名称
    private String channelId;           //所属电视台ID
    private String channelName;         //所属电视台
    private String serverRegion;        //服务器（区域）
    private String serverIp;            //服务器IP
    private String legoProgramId;       //发布后的乐高节目ID
    private String newsProgramId;       //新闻节目拆条id（用于快速匹配）
    private Timestamp productTime;      //日期（创建自动拆条的日期）
    private Integer status;             //状态（0未发布，1发布，2删除）
    private String intelligentTitle;    //识别的标题
    private String submitTitle;         //发布的标题
    private Integer percentTitle;       //标题准确率
    private Integer errorWordNum;       //识别错误的文字数
    private Integer correctWordNum;     //识别正确的文字数
    private Integer intelligentStartNum;//识别的入点
    private Integer submitStartNum;     //发布的入点
    private Integer errorStartNum;      //入点误差
    private Integer intelligentEndNum;  //识别的出点
    private Integer submitEndNum;       //发布的出点
    private Integer errorEndNum;        //出点误差
    private String excLog;              //异常提示
    private String submitUser;          //审核人
    private String costTime;         //拆条时间

    public TNewsDetailsData convertThriftModel() {
        TNewsDetailsData tNewsDetailsData = new TNewsDetailsData();
        tNewsDetailsData.setNewsName(this.getNewsName());
        tNewsDetailsData.setChannelId(this.getChannelId());
        tNewsDetailsData.setChannelName(this.getChannelName());
        tNewsDetailsData.setServerRegion(this.getServerRegion());
        tNewsDetailsData.setServerIp(this.getServerIp());
        tNewsDetailsData.setLegoProgramId(this.getLegoProgramId());
        tNewsDetailsData.setNewProgramId(this.getNewsProgramId());
        tNewsDetailsData.setProductTime(DateTimeUtil.transLongFormat(this.getProductTime().getTime()));
        tNewsDetailsData.setStatus(this.getStatus());
        tNewsDetailsData.setIntelligentTitle(this.getIntelligentTitle());
        tNewsDetailsData.setSubmitTitle(this.getSubmitTitle());
        tNewsDetailsData.setPercentTitle(this.getPercentTitle()==null ? 0 : this.getPercentTitle());
        tNewsDetailsData.setErrorWordNum(this.getErrorWordNum()==null ? 0 : this.getErrorWordNum());
        tNewsDetailsData.setCorrectWordNum(this.getCorrectWordNum()==null ? 0 : this.getCorrectWordNum());
        tNewsDetailsData.setIntelligentStartNum(this.getIntelligentStartNum()==null ? 0 : this.getIntelligentStartNum());
        tNewsDetailsData.setSubmitStartNum(this.getSubmitStartNum()==null ? 0 : this.getSubmitStartNum());
        tNewsDetailsData.setErrorStartNum(this.getErrorStartNum()==null ? 0 : this.getErrorStartNum());
        tNewsDetailsData.setIntelligentEndNum(this.getIntelligentEndNum()==null ? 0 : this.getIntelligentEndNum());
        tNewsDetailsData.setSubmitEndNum(this.getSubmitEndNum()==null ? 0 : this.getSubmitEndNum());
        tNewsDetailsData.setErrorEndNum(this.getErrorEndNum()==null ? 0 : this.getErrorEndNum());
        tNewsDetailsData.setExcLog(this.getExcLog());
        tNewsDetailsData.setSubmitUser(this.getSubmitUser());
        tNewsDetailsData.setCostTime(this.getCostTime());
        return tNewsDetailsData;
    }
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "news_name")
    public String getNewsName() {
        return newsName;
    }

    public void setNewsName(String newsName) {
        this.newsName = newsName;
    }

    @Column(name = "channel_id")
    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    @Column(name = "channel_name")
    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    @Column(name = "server_region")
    public String getServerRegion() {
        return serverRegion;
    }

    public void setServerRegion(String serverRegion) {
        this.serverRegion = serverRegion;
    }

    @Column(name = "server_ip")
    public String getServerIp() {
        return serverIp;
    }

    public void setServerIp(String serverIp) {
        this.serverIp = serverIp;
    }

    @Column(name = "lego_program_id")
    public String getLegoProgramId() {
        return legoProgramId;
    }

    public void setLegoProgramId(String legoProgramId) {
        this.legoProgramId = legoProgramId;
    }

    @Column(name = "news_program_id")
    public String getNewsProgramId() {
        return newsProgramId;
    }

    public void setNewsProgramId(String newsProgramId) {
        this.newsProgramId = newsProgramId;
    }

    @Column(name = "product_time")
    public Timestamp getProductTime() {
        return productTime;
    }

    public void setProductTime(Timestamp productTime) {
        this.productTime = productTime;
    }

    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name = "intelligentTitle")
    public String getIntelligentTitle() {
        return intelligentTitle;
    }

    public void setIntelligentTitle(String intelligentTitle) {
        this.intelligentTitle = intelligentTitle;
    }

    @Column(name = "submit_title")
    public String getSubmitTitle() {
        return submitTitle;
    }

    public void setSubmitTitle(String submitTitle) {
        this.submitTitle = submitTitle;
    }

    @Column(name = "percent_title")
    public Integer getPercentTitle() {
        return percentTitle;
    }

    public void setPercentTitle(Integer percentTitle) {
        this.percentTitle = percentTitle;
    }

    @Column(name = "error_word_num")
    public Integer getErrorWordNum() {
        return errorWordNum;
    }

    public void setErrorWordNum(Integer errorWordNum) {
        this.errorWordNum = errorWordNum;
    }

    @Column(name = "correct_word_num")
    public Integer getCorrectWordNum() {
        return correctWordNum;
    }

    public void setCorrectWordNum(Integer correctWordNum) {
        this.correctWordNum = correctWordNum;
    }

    @Column(name = "intelligent_start_num")
    public Integer getIntelligentStartNum() {
        return intelligentStartNum;
    }

    public void setIntelligentStartNum(Integer intelligentStartNum) {
        this.intelligentStartNum = intelligentStartNum;
    }

    @Column(name = "submit_start_num")
    public Integer getSubmitStartNum() {
        return submitStartNum;
    }

    public void setSubmitStartNum(Integer submitStartNum) {
        this.submitStartNum = submitStartNum;
    }

    @Column(name = "error_start_num")
    public Integer getErrorStartNum() {
        return errorStartNum;
    }

    public void setErrorStartNum(Integer errorStartNum) {
        this.errorStartNum = errorStartNum;
    }

    @Column(name = "intelligent_end_num")
    public Integer getIntelligentEndNum() {
        return intelligentEndNum;
    }

    public void setIntelligentEndNum(Integer intelligentEndNum) {
        this.intelligentEndNum = intelligentEndNum;
    }

    @Column(name = "submit_end_num")
    public Integer getSubmitEndNum() {
        return submitEndNum;
    }

    public void setSubmitEndNum(Integer submitEndNum) {
        this.submitEndNum = submitEndNum;
    }

    @Column(name = "error_end_num")
    public Integer getErrorEndNum() {
        return errorEndNum;
    }

    public void setErrorEndNum(Integer errorEndNum) {
        this.errorEndNum = errorEndNum;
    }

    @Column(name = "exc_log")
    public String getExcLog() {
        return excLog;
    }

    public void setExcLog(String excLog) {
        this.excLog = excLog;
    }

    @Column(name = "submit_user")
    public String getSubmitUser() {
        return submitUser;
    }

    public void setSubmitUser(String submitUser) {
        this.submitUser = submitUser;
    }

    @Column(name = "cost_time")
    public String getCostTime() {
        return costTime;
    }

    public void setCostTime(String costTime) {
        this.costTime = costTime;
    }
}
